﻿<Window x:Class="SBPweb.Presentation.Windows.WPF.Host.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:tools3d="clr-namespace:_3DTools;assembly=3DTools"
    xmlns:SBPwebControls="clr-namespace:SBPweb.Presentation.Windows.WPF.Controls;assembly=SBPweb.Presentation.Windows.WPF"
    xmlns:SBPwebPrimitives="clr-namespace:SBPweb.Presentation.Windows.WPF.Primitives;assembly=SBPweb.Presentation.Windows.WPF"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
    Title="MainWindow"
        Width="800"
        Height="600"
        Background="Black">

    <Window.Resources>
        <MeshGeometry3D x:Key="PlaneMesh"
							Positions="-1,0,1  1,0,1  1,0,-1  -1,0,-1"
							Normals="0,0,1  0,0,1  0,0,1  0,0,1"
							TriangleIndices="0 1 3  1 2 3"
							TextureCoordinates="0 0  1 0  1 1  0 1" />
        <SBPwebPrimitives:CubeMesh x:Key="CubeMeshSource" Width="1" />
        <SBPwebPrimitives:SphereMesh x:Key="SphereMeshSource" Radius="1" />
        <MeshGeometry3D
                        x:Key="SphereMesh1"
                        Positions="{Binding Source={StaticResource SphereMeshSource}, Path=Positions}"
                        TriangleIndices="{Binding Source={StaticResource SphereMeshSource}, Path=TriangleIndices}"
                        Normals="{Binding Source={StaticResource SphereMeshSource}, Path=Normals}"
                        TextureCoordinates="{Binding Source={StaticResource SphereMeshSource}, Path=TextureCoordinates}"/>

        <!--Transform3DGroup x:Key="MenuTransform">
            <ScaleTransform3D ScaleX="2" />
            <RotateTransform3D>
                <RotateTransform3D.Rotation>
                    <AxisAngleRotation3D Axis="0,1,0" Angle="180" />
                </RotateTransform3D.Rotation>
            </RotateTransform3D>
        </Transform3DGroup>

        <Style x:Key="MenuPanelGrid" TargetType="{x:Type Grid}">
            <Setter Property="Background" Value="White" />
            <Setter Property="Height" Value="130" />
        </Style>

        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="Margin" Value="5,2,0,0" />
        </Style-->

    </Window.Resources>


    <Grid x:Name="outerGrid" Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">

        <tools3d:TrackballDecorator x:Name="devTrackBall" DockPanel.Dock="Bottom" Height="Auto">
            <tools3d:Interactive3DDecorator Margin="0,0,5,0">
                <Viewport3D x:Name="viewport">
                    <Viewport3D.Camera>
                        <PerspectiveCamera FieldOfView="50" LookDirection="0,0,-1" NearPlaneDistance="0" Position="0,0,0">
                            <PerspectiveCamera.Transform>
                                <Transform3DGroup>
                                    <TranslateTransform3D OffsetX="0" OffsetY="0.1" OffsetZ="1"/>
                                    <ScaleTransform3D ScaleX="1" ScaleY="1" ScaleZ="1"/>
                                    <RotateTransform3D d:EulerAngles="0,0,0"/>
                                </Transform3DGroup>
                            </PerspectiveCamera.Transform>
                        </PerspectiveCamera>
                    </Viewport3D.Camera>
                    <ModelVisual3D x:Name="light">
                        <ModelVisual3D.Content>
                            <Model3DGroup>
                                <AmbientLight Color="#FFFFFF" />
                            </Model3DGroup>
                        </ModelVisual3D.Content>
                    </ModelVisual3D>
                    <ModelVisual3D x:Name="meshes">
                        <ModelVisual3D.Content>
                            <Model3DGroup>
                                <GeometryModel3D
                                    Geometry="{Binding Source={StaticResource PlaneMesh}}">
                                    <GeometryModel3D.Material>
                                        <MaterialGroup>
                                            <EmissiveMaterial>
                                                <EmissiveMaterial.Brush>
                                                    <SolidColorBrush Opacity="0.2" Color="#00FF00"/>
                                                </EmissiveMaterial.Brush>
                                            </EmissiveMaterial>
                                            <DiffuseMaterial>
                                                <DiffuseMaterial.Brush>
                                                    <VisualBrush Visual="{Binding ElementName=viewPort}"/>
                                                </DiffuseMaterial.Brush>
                                            </DiffuseMaterial>
                                        </MaterialGroup>
                                    </GeometryModel3D.Material>
                                </GeometryModel3D>
                                <GeometryModel3D
                                    Geometry="{StaticResource SphereMesh1}">
                                    <GeometryModel3D.Material>
                                        <MaterialGroup>
                                            <EmissiveMaterial>
                                                <EmissiveMaterial.Brush>
                                                    <SolidColorBrush Opacity="0.5" Color="#FF0000"/>
                                                </EmissiveMaterial.Brush>
                                            </EmissiveMaterial>
                                        </MaterialGroup>
                                    </GeometryModel3D.Material>
                                    <GeometryModel3D.Transform>
                                        <Transform3DGroup>
                                            <TranslateTransform3D OffsetX="0" OffsetY="2" OffsetZ="0" />
                                            <ScaleTransform3D ScaleX="0.1" ScaleY="0.1" ScaleZ="0.1" />
                                        </Transform3DGroup>
                                    </GeometryModel3D.Transform>
                                </GeometryModel3D>
                            </Model3DGroup>
                        </ModelVisual3D.Content>
                        
                    </ModelVisual3D>



                </Viewport3D>

            </tools3d:Interactive3DDecorator>
        </tools3d:TrackballDecorator>
        <!--Border Width="200" Height="100" Name="Movie" BorderBrush="White" CornerRadius="2" BorderThickness="2" RenderTransform="1 0 0 1 0 200">
            <MediaElement Source="C:\Media\Videos\BSG\battlestar.galactica.s04e01.hdtv-lol.avi" />
        </Border-->

    </Grid>

</Window>
